﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ThePushCSharp
{
    public class AttackType
    {
        public const String PIERCING     = "Piercing";
        public const String BLUNT        = "Blunt";
        public const String EXPLOSIVE    = "Explosive";

        public String attackType;
        public int attackRangeMax;
        public int attackRangeMin;
        public int attackDamage;

        public AttackType(String attackType, int attackRangeMax, int attackRangeMin, int attackDamage)
        {
            this.attackType = attackType;
            this.attackRangeMax = attackRangeMax;
            this.attackRangeMin = attackRangeMin;
            this.attackDamage = attackDamage;
        }

        public int getDamage(ArmorType armorType)
        {
            //Gets the danage for this particular attack based on the base damage; min and max damage ranges..
            float dmg = attackDamage + attackRangeMin + GameState.random.Next(attackRangeMax);

            switch (attackType)
            {
                case AttackType.PIERCING:
                    if (armorType.name == ArmorType.LIGHT)
                        dmg *= 2.0f;
                    if (armorType.name == ArmorType.MEDIUM)
                        dmg *= 0.5f;
                    break;
                case AttackType.BLUNT:
                    if (armorType.name == ArmorType.MEDIUM)
                        dmg *= 2.0f;
                    if (armorType.name == ArmorType.HEAVY)
                        dmg *= 0.5f;
                    break;
                case AttackType.EXPLOSIVE:
                    if (armorType.name == ArmorType.HEAVY)
                        dmg *= 2.0f;
                    if (armorType.name == ArmorType.LIGHT)
                        dmg *= 0.5f;
                    break;
            }

            return (int)Math.Ceiling(dmg);
        }
    }
}
